import request from '/@/utils/request'
import {prefix} from '/@/api/money'

export default {
  getTreeData(params) {
    return request({
      url: prefix + '/capitalType/getTreeList',
      method: 'get',
      params
    })
  },
  /**
   * 不分级列表
   * @param type 0收入 1支出
   */
  getList(type = '') {
    return request({
      url: prefix + '/capitalType/getList?type=' + type,
      method: 'get'
    })
  },
  /**
   * 根节点列表
   */
  getRoots(type = '') {
    return request({
      url: prefix + '/capitalType/getRootList?type=' + type,
      method: 'get'
    })
  },
  create(data) {
    return request({
      url: prefix + '/capitalType/create',
      method: 'post',
      data
    })
  },
  edit(data) {
    return request({
      url: prefix + '/capitalType/edit',
      method: 'post',
      data
    })
  },
  remove(data) {
    return request({
      url: prefix + '/capitalType/delete',
      method: 'post',
      data
    })
  }
}
